<?php
class IndexAction extends Action   {
	
	public function Index(){
		
		
	}
	
	/*获取对方网页
	public function Index(){
		
		$contents = $this->vget('http://www.xxx.com', 'www.xxx.com');
		preg_match("/<div class=\"nav_c\">(.*?)<\/div>/is",$contents,$title);
		p($title);
		
	}
	
	function vget($url, $Referer='http://www.xxx.com/') {
	$curl = curl_init();
	curl_setopt($curl, CURLOPT_URL, $url);
	curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18 ( .NET CLR 3.5.30729)');  
	curl_setopt($curl, CURLOPT_REFERER, $Referer);
	curl_setopt($curl, CURLOPT_TIMEOUT, 50); // 设置超时限制防止死循环    
	curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容    
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回    
	$tmpInfo = curl_exec($curl);
	if (curl_errno($curl)) {
		$arr = parse_url($Referer);
		file_put_contents(dirname(__FILE__)."/game_err_logs.log", $arr['host'].' Errno: '.curl_error($curl)."\t".date("Y-m-d")."\n", FILE_APPEND);
		return '';
	} else {
		curl_close($curl);
		return $tmpInfo;
	}
}
*/

	/*
	public function index(){
	$joins = M('joins')->where("id=1")->find();
	$this->assign(view,$joins['view']);
	$this->display(index);
	}
	
	public function say(){
		if (!IS_AJAX) halt("页面不存在!");
		$data = array(
			'one' => I('one'),
			'two' => I('two'),
			'three' => I('three'),
			'four' => I('four'),
			'five' => I('five'),
			'times' => time(),
			
		);
		
		if ($id = M('answer')->data($data)->add()) {
				$data['id'] = $id;
				$data['status'] = '1';
				M('joins')->where('id=1')->setInc('view',1);
				$this->ajaxReturn($data,'json');
			}else{
				$this->ajaxReturn(array('status' => 0),'json');
			}
		
	}
	
	public function save(){
		if (!$_POST) halt("页面不存在!");
		$date = array(
			'username' => I('username'),
			'mobil' => I('mobil'),
			'address' => I('address'),
			'times' => time(),
		);
		
		$location = get_client_ip(); 
		$ipaddress =array(
			'ip' => $location,
		);
		
		$id = M('ip')->where(array('ip'=>$location))->find();
		if (!$id) {
			M('user')->data($date)->add();
			M('ip')->data($ipaddress)->add();
			$this->redirect('/');
		}else{
			header("Content-Type:text/html; charset=utf-8");
			echo "<script>alert('一个IP只能提交一次!谢谢!');location.href='/';</script>";
		}
		
		
		
		
			
		$('#send-btn').click(function(){
 	
 		var one;
        $("input[name=one]").each(function () {
            if ($(this).attr("checked") == true) {
                one=$(this).val();
            }
        })
	
		$.post(say, {one:one, two:two ,three:three , four:four ,five:five},
		function (data){
		if (data.status){
			alert('回答正确');
			var str ='<div style="position:absolute; border:1px solid #000;top:1000px;left:30%;" >';
				str +='<form method="POST" name="form" action="{:U("Index/Index/save","","")}" onsubmit="return formcheck()" >';
				str +='<table  bgcolor="White" width="350" height="160">';
				str +='<tr><td colspan=2 align="center" style="color:#999;font-size:14px"><b>个人信息</b></td></tr><tr>';
				str +='<td width="100" align="right" height="25" style="color:#999;">姓名：</td>';
				str +='<td><input type="text" name="username" id="username" value=""></td></tr><tr>';
				str +='<td align="right" height="25" style="color:#999;">手机号码：</td>';
				str +='<td><input type="text" name="mobil" id="mobil" value=""></td></tr><tr>';
				str +='<td align="right" height="25" style="color:#999;">详细地址:</td>';
				str +='<td><input type="text" name="address" id="address" value=""></td></tr><tr>';
				str +='<td colspan=2 align="center" ><input type="submit" name="button" value="提交"></td></tr>';
				str +='</table></form></div>';
			
			$(".a1").append(str);	
		}else{
			alert('回答失败');
		}
		},'json');
				
		 }
		 )
 		
	}
	*/
} 